package org.meb.spdwldr.parser;

import java.util.ArrayList;
import java.util.List;

import org.meb.spdwldr.EventSource;

public class EventSourceParserChain implements EventSourceParser {

	private List<EventSourceParser> parsers;

	public EventSourceParserChain() {
		parsers = new ArrayList<EventSourceParser>();
		parsers.add(new EventSourceParserImplV1());
	}

	@Override
	public List<EventSource> parse(String content) {
		for (EventSourceParser parser : parsers) {
			List<EventSource> eventSources = parser.parse(content);
			if (eventSources != null && eventSources.size() != 0) {
				return eventSources;
			}
		}
		return null;
	}
}
